package com.dx.order.service;

import com.dx.model.OrderInfo;
import com.dx.model.UserInfo;
import com.dx.order.dao.OrderDao;
import com.dx.order.feign.UserServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * Created by lzh on 2017/10/23.
 */
@Service
public class OrderService {

    @Autowired
    private OrderDao orderDao;

    @Autowired
    private UserServer userServer;

    public OrderInfo getOrderInfoById(Integer orderId){
       return orderDao.getOrderInfoById(orderId);
    }

    public UserInfo getUserInfoByOrderId(Integer orderId){
        OrderInfo orderInfo=orderDao.getOrderInfoById(orderId);
        return userServer.getUserById(orderInfo.getUserId());
    }

    public String getUserIdByOrderId(Integer orderId){
        return orderDao.getUserIdByOrderId(orderId);
    }

    public OrderInfo getOrderInfoByDate(Date date){
        return orderDao.getOrderInfoByDate(date);
    }
}
